package com.hjxr.xmgl.web.controller;

import com.hjxr.framework.web.domain.AjaxResult;
import com.hjxr.xmgl.web.domain.SqlStatement;
import com.hjxr.xmgl.web.service.SqlStatementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

@RestController
@Api(tags = "sql语句查询")
public class SqlStatementController {

    @Autowired
    SqlStatementService statementService;

    @PostMapping("/sql/sqlFind")
    @ApiOperation("sql语句查找字段")
    public AjaxResult getFileds(@RequestBody SqlStatement sqlStatement){

        System.out.println("----------sqlStr----------" + sqlStatement.SqlStr);
        List<HashMap<String,Object>> sqlstatementList = statementService.sqlExecute(sqlStatement.SqlStr);
        return AjaxResult.success(sqlstatementList);
    }
}
